//
//  PFScanResultFirstTableViewCell.m
//  PFScan
//
//  Created by perfayMini on 2018/10/25.
//  Copyright © 2018 perfayMini. All rights reserved.
//

#import "PFScanResultFirstTableViewCell.h"

@implementation PFScanResultFirstTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        [self config];
    }
    return self;
}

- (void)config{
    self.iconImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.iconImageView];

    self.nameLabel = [[UILabel alloc] init];
    self.nameLabel.textColor = [UIColor blackColor];
    self.nameLabel.font = SYSTEMFONT(14);
    self.nameLabel.numberOfLines = 0;
    self.nameLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:self.nameLabel];

}


-(void)setTitle:(NSString *)title{
    _title =  title;
    
    self.iconImageView.sd_layout
    .widthIs(25)
    .heightEqualToWidth()
    .leftSpaceToView(self.contentView, 12)
    .topSpaceToView(self.contentView, 12);
    
    self.nameLabel.sd_layout
    .topSpaceToView(self.contentView,17)
    .leftSpaceToView(self.iconImageView, 12)
    .autoHeightRatio(0);
    
    [self.nameLabel setSingleLineAutoResizeWithMaxWidth:SCREEN_WIDTH -24 - 25 - 12];
    self.nameLabel.text = title;
    [self setupAutoHeightWithBottomView:self.nameLabel bottomMargin:10];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {

    // Configure the view for the selected state
}

@end
